package com.zonta.finance.domain.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 系统菜单
 * </p>
 *
 * @author zonta
 * @since 2024-07-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_menu")
@ApiModel(value="SysMenu对象", description="系统菜单")
public class SysMenu implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "父级菜单")
    private Integer pid;

    @ApiModelProperty(value = "菜单名称")
    private String name;

    @ApiModelProperty(value = "菜单路由")
    private String path;

    @ApiModelProperty(value = "菜单组件")
    private String component;

    @ApiModelProperty(value = "图标")
    private String icon;

    @ApiModelProperty(value = "是否使用布局")
    private Boolean layout;

    @ApiModelProperty(value = "是否隐藏菜单")
    private Boolean hideInMenu;

    @ApiModelProperty(value = "重定向地址")
    private String redirect;

    @ApiModelProperty(value = "排序")
    private Integer sort;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    private Date updateTime;

    @ApiModelProperty(value = "用户id")
    private Long memberId;

    @ApiModelProperty(value = "修改用户id")
    private Long updateMemberId;

    @ApiModelProperty(value = "是否删除，0：删除，1：未删除")
    private Boolean delFlag;

    @ApiModelProperty(value = "是否禁用")
    private Boolean disable;

    @ApiModelProperty(value = "节点深度，0表示一级节点")
    private Integer nodePath;

    public void initDefault() {
        if (this.getPid() == null) {
            this.setPid(0);
        }
        if (this.getName() == null) {
            this.setName("");
        }
        if (this.getPath() == null) {
            this.setPath("");
        }
        if (this.getComponent() == null) {
            this.setComponent("");
        }
        if (this.getIcon() == null) {
            this.setIcon("");
        }
        if (this.getLayout() == null) {
            this.setLayout(false);
        }
        if (this.getHideInMenu() == null) {
            this.setHideInMenu(false);
        }
        if (this.getRedirect() == null) {
            this.setRedirect("");
        }
        if (this.getSort() == null) {
            this.setSort(0);
        }
        if (this.getCreateTime() == null) {
            this.setCreateTime(new Date());
        }
        if (this.getUpdateTime() == null) {
            this.setUpdateTime(new Date());
        }
        if (this.getMemberId() == null) {
            this.setMemberId(0L);
        }
        if (this.getUpdateMemberId() == null) {
            this.setUpdateMemberId(0L);
        }
        if (this.getDelFlag() == null) {
            this.setDelFlag(false);
        }
        if (this.getDisable() == null) {
            this.setDisable(false);
        }
        if (this.getNodePath() == null) {
            this.setNodePath(0);
        }
    }

}
